package com.gidgabs.modules.api.controller.journal;

import com.gidgabs.common.utils.ReturnJson;
import com.gidgabs.common.validator.Assert;
import com.gidgabs.dto.TbUserDto;
import com.gidgabs.dto.TbUserJournalDto;
import com.gidgabs.modules.api.service.journal.JournalRankingService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created by tby on 2018/7/12.
 */

@Api("日志模块-用户排行")
@RestController
@RequestMapping("api/journal")
public class ApiJournalRankingController {
    @Autowired private JournalRankingService journalRankingService;

    @ApiOperation(value = "排行榜-按照打赏数量,发表的日志数量排序")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "pageSize",value = "页面大小",dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "pageNo",value = "页码",dataType = "int",paramType = "query"),
            @ApiImplicitParam(name = "token",value = "token",dataType = "string",paramType = "header")
    })
    @RequestMapping(value = "ranking", method = RequestMethod.GET, produces = {"application/json;charset=UTF-8"})
    public ReturnJson<TbUserDto> queryList(Integer pageSize, Integer pageNo ) {

        if (pageSize==null) pageSize=10;
        if (pageNo==null) pageNo=1;
        return journalRankingService.queryList(pageSize,pageNo);
    }
}
